<template>
    <div id="book-info">
        <el-page-header @back="goBack" content="返回列表">
        </el-page-header>
        <div style="margin-bottom: 10px;"></div>
        <h3>书名：{{ form.name }}</h3>
        <h3>作者：{{ form.author }}</h3>
        <p>类别：{{ form.categoryName }}</p>
        <el-card class="box-card" v-for="(item, index) in form.comment" :key="index">
            <div class="text-del">
                <span>评论：{{ item }}</span>
                <!-- <span @click="delBtn(item.id)" style="cursor: pointer;color: blue;">删除</span> -->
            </div>
        </el-card>
    </div>
</template>

<script>
import { commentInfo, addComment } from '@/api/comment'

export default {

    methods: {
        delBtn(id){

        },
        getBookInfo() {
            commentInfo({ id: this.id }).then(res => {
                this.form = res.data
            }).catch(error => {
                reject(error)
            })
        },
        goBack() {
            this.$router.push("/book/book_comment")
        },
        continue_library() {
            lendOutInfo({ id: this.id }).then(res => {
                this.$message({
                    type: 'warning',
                    message: res.data
                });
                this.getBookInfo()
            }).catch(error => {
                reject(error)
            })
        }

    },
    created() {
        this.id = this.$route.query.id;
        this.getBookInfo()
    },
    data() {
        return {
            id: '',
            form: [],
            srcImg: ''
        }
    }
}
</script>


<style  lang="scss" scoped>
#book-info {
    padding: 40px 20px;
    width: 60%;

    .box-card {
        margin-bottom: 20px;
    }

    .text-del{
        display: flex;
        justify-content: space-between;
    }
}
</style>